/* example get_sysinfo.c */
/* compile with: gcc -g -Wall get_sysinfo.c -o get_sysinfo -lvirt */

#include <stdio.h>
#include <stdlib.h>
#include <libvirt/libvirt.h>

int main(int argc, char *argv[])
{
    virConnectPtr   conn;
    char           *sys_info;

    conn = virConnectOpen("qemu:///system");
    if (conn == NULL) {
		fprintf(stderr, "Failed to open connection to qemu:///system\n");
		return 1;
    }

    sys_info = virConnectGetSysinfo(conn, 0);
    fprintf(stdout, "System info: \033[41;37m%s\033[0m\n", sys_info);
    free(sys_info);

    virConnectClose(conn);
    return 0;
}
